<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<s:include value="/WEB-INF/content/common/header.jsp"></s:include>
</head>

<body class="bg">
	<s:include value="/WEB-INF/content/common/title-head.jsp"></s:include>

	<div class="content">
		<s:include value="/WEB-INF/content/common/tab.jsp"></s:include>
		<script>
			$("#timerTab").addClass("active");
		</script>
		<div class="body">
			<div class="row">
				<div class="span4">
					<h3>
						<s:text name="timer.list" />
					</h3>
					<p style="width: 100%" class="text-right">
						ソート: 時間 | <a>スイッチ</a>
					</p>
					<ul class="unstyled">
						<!-- <li class="switch"><a>16:00 キッチン ON</a>
							<button class="close">&times;</button></li> -->
						<s:iterator value="timerSwitch" status="rowIindexLevel1">
							<s:url var="viewTimerUrl" action="edit" namespace="/timer">
								<s:param name="id" value="%{id}" />
							</s:url>
							<s:url action="delete" namespace="/timer"
									var="timerDeleteUrl" includeParams="none">
									<s:param name="id" value="%{id}" />
								</s:url>
							<li><sj:a href="%{#viewTimerUrl}" targets="targetDiv">
									<s:property value="timerHour" />:<s:property value="timerMin" />
									<s:property value="name" />
									<s:property value="switchName" />
									<s:property value="switchSetting" />
								</sj:a>
								
								<s:a href="%{#timerDeleteUrl}" onclick="return confirmDelete()" cssClass="close">
										&times;
									</s:a></li>
						</s:iterator>
						<!--  <li class="switch"><a>18:00 リビング ON</a><button class="close">&times;</button></li>
            <li class="switch"><a>20:00 キッチン OFF</a><button class="close">&times;</button></li>
            <li class="switch"><a>21:00 リビング OFF</a><button class="close">&times;</button></li>-->
						<s:url var="addTimerUrl" action="add" namespace="/timer">
							<s:param name="id" value="%{id}" />
						</s:url>

						<li class="switch"><i class="icon-plus"></i>
						<sj:a href="%{#addTimerUrl}" targets="targetDiv">

								<s:text name="timer.link.new" />
							</sj:a></li>

					</ul>
				</div>
				<div class="span7">
					<div id="targetDiv">
						<s:if test="actionMessage != null">
							<s:url action="edit" namespace="/timer" var="timerViewUrl"
								includeParams="none" escapeAmp="false">
								<s:param name="id" value="%{id}" />
								<s:param name="actionMessage" value="%{actionMessage}" />
							</s:url>
							<sj:div href="%{timerViewUrl}" />
						</s:if>
						<s:elseif test="actionError != null">
							<s:url action="edit" namespace="/timer" var="timerViewUrl"
								includeParams="none" escapeAmp="false">
								<s:param name="id" value="%{id}" />
								<s:param name="actionError" value="%{actionError}" />
							</s:url>
							<sj:div href="%{timerViewUrl}" />
						</s:elseif>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div id="footer">
		<s:include value="/WEB-INF/content/common/footer.jsp"></s:include>
	</div>
</body>
</html>